package com.aires.testapplicationlistener;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @program: spring
 * @description:
 * @author: fan zhengxiang
 * @create: 2020-11-02 20:33
 */
public class MainClass {
	public static void main(String[] args) {
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(AiresApplicationListener.class);
		// 通过容器发布事件
		context.publishEvent(new ApplicationEvent("手动发布一个事件") {
			@Override
			public Object getSource() {
				return super.getSource();
			}
		});
		context.close();
	}
}